import sys
from ncov import ncov_analyse

# 参数说明：
# 1
# t:total
# n:newly increased
# 2
# d:death count
# c:cured count
# f:confirmed count
# 3
# r:rate
# 组合范围：12,23  如td  nf dr

# sys.argv = ['', ['td', 'tc'], '湖北', '武汉']
na = ncov_analyse()
mode = sys.argv[1].split(',')
na.pname = sys.argv[2]
if len(sys.argv) == 4:
    na.cname = sys.argv[3]
    showName = na.cname
    info = na.findAllByCity()
else:
    showName = na.pname
    info = na.findAllByProvince()
for i in mode:
    if i[1] == 'r':
        if i[0] == 'd':
            print('death rate')
        elif i[0] == 'c':
            print('cured rate')
        else:
            print('wrong command')
    elif i[1] == 'd':
        na.sortType = 'deadCount'
        if i[0] == 't':
            print('total death count')
            na.staType = 'total'
            data = na.calTotal()
        elif i[0] == 'n':
            print('newly increased death count')
            na.staType = 'newly increased'
            data = na.calNewlyIncreased()
        else:
            print('wrong command')
    elif i[1] == 'c':
        na.sortType = 'curedCount'
        if i[0] == 't':
            print('total cured count')
            na.staType = 'total'
            data = na.calTotal()
        elif i[0] == 'n':
            print('newly increased cured count')
            na.staType = 'newly increased'
            data = na.calNewlyIncreased()
        else:
            print('wrong command')
    elif i[1] == 'f':
        na.sortType = 'confirmedCount'
        if i[0] == 't':
            print('total confirmed count')
            na.staType = 'total'
            data = na.calTotal()
        elif i[0] == 'n':
            print('newly increased confirmed count')
            na.staType = 'newly increased'
            data = na.calNewlyIncreased()
        else:
            print('wrong command')
    else:
        print('wrong command')
    print(na.data)
    na.draw()
